home *** CD-ROM | disk | FTP | other *** search
- TForm f;
- TGroupbox g;
- TRadioButton rb1,rb2;
- TButton b;
-
- void ButtonClick(TButton Sender)
- {
- if (rb1.Checked)
- ShowMessage("Option 1 was selected");
- else if (rb2.Checked)
- ShowMessage("Option 2 was selected");
- f.ModalResult = mrOk;
- }
-
- {
- f = new TForm(nil);
- f.Caption = "MyApp...";
- f.BorderStyle = bsSizeable;
- f.Position = poScreenCenter;
- f.Width = 400;
- f.Height = 300;
- int w = f.ClientWidth;
- int h = f.ClientHeight;
-
- // Options ----------------------------
- g = new TGroupBox(f);
- g.Name = "gOptions";
- g.Parent = f;
- g.SetBounds(10, 10, 200, 100);
- g.Anchors = akLeft+akTop;
- g.Caption = "Options";
-
- rb1 = new TRadioButton(g);
- rb1.Name = "rb1";
- rb1.Parent = g;
- rb1.Left = 10;
- rb1.Top = 20;
- rb1.Width = g.Width - 11;
- rb1.Anchors = akLeft+akTop;
- rb1.Caption = "Option 1";
- rb1.Checked = True;
-
- rb2 = new TRadioButton(g);
- rb2.Name = "rb2";
- rb2.Parent = g;
- rb2.Parent = g;
- rb2.Left = 10;
- rb2.Top = rb1.Top + rb1.Height + 5;
- rb2.Width = g.Width - 11;
- rb2.Anchors = akLeft+akTop;
- rb2.Caption = "Option 2";
- //-------------------------------------
-
- // Go button
- b = new TButton(f);
- b.Name = "btnGo";
- b.Parent = f;
- b.SetBounds(w - 80, h - 30, 75, 25);
- b.Anchors = akRight+akBottom;
- b.Caption = "Go";
-
- b.OnClick = &ButtonClick;
-
- // Show the dialog
- f.ShowModal;
- f.Free;
-
- }
-
-